use serde::Serialize;

#[derive(Serialize, Debug)]
pub struct CmdResult {
    pub success: bool,
    pub message: String,
    pub data: String,
}

impl CmdResult {
    pub fn yes(msg: String, data: String) -> anyhow::Result<Self> {
        Ok(Self {
            success: true,
            message: msg,
            data,
        })
    }
    pub fn no(msg: String) -> anyhow::Result<Self> {
        Ok(Self {
            success: false,
            message: msg,
            data: String::new(),
        })
    }
}
